home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / ISALNUM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  744 b   |  40 lines

  1. #include <stdio.h>
  2. #include <ctype.h>
  3. main()
  4. {
  5.     int ch, count,
  6.     mark = 0xdb;                /* to mark characters */
  7.  
  8.             /* Go over entire ASCII table and display the
  9.              * alphanumeric ones. */
  10.     printf("Alphanumeric ones are marked with a %c\n", mark);
  11.     printf(" ");        /* This was added to help the format */
  12.     for(count = 0, ch = 0; ch <=0x7f; ch++)
  13.     {
  14.         printf("%#02x", ch);
  15.                     /* Print character- if printable */
  16.         if(isprint(ch))
  17.         {
  18.             printf(" %c ", ch);
  19.         }
  20.         else
  21.         {
  22.             printf("  ");
  23.         }
  24.             /* Perform test and put a mark if test succeeds */
  25.         if(isalnum(ch) != 0)
  26.         {
  27.             printf(" %c", mark);
  28.         }
  29.         else
  30.         {
  31.             printf("  ", ch);
  32.         }
  33.         count++;
  34.         if (count == 8)
  35.         {
  36.             printf(" \n");
  37.             count = 0;
  38.         }
  39.     }
  40. }